home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr47
/
wasm223.zip
/
RECEIVE
< prev
next >
Wrap
Text File
|
1993-05-04
|
2KB
|
47 lines
//
// SESSION Receive Routines, By Eric Tauck
//
// Requires:
//
// STRING
// TIMER
//
Receive_End JUMP
// --------------------------------------------
// Wait for a byte. Must call TimerReset first.
// --------------------------------------------
: WaitForByte // ( - 0 | byte -1)
: WaitForByte1
CGET ?DUP NOT WaitForByte2 ?JUMP ; // get byte, exit if returned
: WaitForByte2 // byte not returned
BREAK TimerExpired CALL // break and check if time expired
NOT WaitForByte1 ?JUMP // loop back if not
FALSE ; // timeout
// ------------------------------------------
// Wait for a string. Return TRUE if success.
// ------------------------------------------
: WaitForString // (string ticks - 0 | -1)
TimerReset CALL // reset timer
: WaitForString1
DUP WaitForStringChar ForString? CALL // try receiving string
?DUP NOT WaitForString2 ?JUMP // jump if unsuccessful
SWAP DROP ; // success, exit
: WaitForString2
TimerExpired CALL // check if time expired
NOT WaitForString1 ?JUMP // loop back if not
DROP FALSE ; // timeout
: WaitForStringChar // (byte - 0 | -1)
WaitForByte CALL // wait for a byte
WaitForStringChar1 ?JUMP // jump if byte returned
DROP FALSE ; // no byte, exit
: WaitForStringChar1 // byte returned
DUP CREP = ; // replace and compare byte
: Receive_End